shadow:standard@CanCompare<shadow:standard@String>, shadow:standard@CanIterate<code>, shadow:standard@CanIndex<int,ubyte>, shadow:standard@CanHash
immutable locked class String
Class String holds arbitrary-length sequences of UTF-8 code points stored in a fixed-size array of ubyte values. String objects are the most common way to represent text in Shadow. String objects differ from MutableString objects in that their contents cannot be changed.
| Modifiers | Return Types | Method and Description |
|---|---|---|
public |
() |
create()Creates a new empty |
public |
() |
create(code[] data)Creates a new |
public |
() |
create(String other)Creates a new |
public |
() |
create(ubyte[] data)Creates a new |
| Modifiers | Return Types | Method and Description |
|---|---|---|
public |
() |
destroy() |
| Modifiers | Return Types | Method and Description |
|---|---|---|
public readonly locked |
(int) |
compare(String other)Compares the current object to another |
public readonly locked |
(String) |
concatenate(nullable Object other)Produces a new |
public readonly locked |
(String) |
concatenate(String other)Produces a new |
public readonly |
(String) |
copy(AddressMap addresses) |
public readonly locked |
(boolean) |
equal(String other)Compares the current object to another |
public readonly locked |
(ubyte) |
index(long location)Retrieves the |
public readonly locked |
(boolean) |
isEmpty()Returns |
public readonly locked |
(Iterator<code>) |
iterator()Gets iterator that can iterate over each code point in the |
public readonly locked |
(String) |
substring(int start)Produces a substring of this string representation, from the starting byte offset up to the end. |
public readonly locked |
(String) |
substring(int start, int end)Produces a substring of this string representation, from the starting byte offset up to but not including the ending byte offset. |
public readonly locked |
(byte) |
toByte()Parses the |
public readonly locked |
(double) |
toDouble()Parses the |
public readonly locked |
(float) |
toFloat()Parses the |
public readonly locked |
(int) |
toInt()Parses the |
public readonly locked |
(long) |
toLong()Parses the |
public readonly locked |
(String) |
toLowerCase()Returns a lower-case version of this |
public readonly locked |
(short) |
toShort()Parses the |
public readonly locked |
(String) |
toString()Returns a |
public readonly locked |
(ubyte) |
toUByte()Parses the |
public readonly locked |
(uint) |
toUInt()Parses the |
public readonly locked |
(ulong) |
toULong()Parses the |
public readonly locked |
(ushort) |
toUShort()Parses the |
public readonly locked |
(String) |
toUpperCase()Returns an upper-case version of this |
| Modifiers | Return Types | Method and Description |
|---|---|---|
public readonly get locked |
(immutable ubyte[]) |
chars()Retrieves an immutable copy of the |
public readonly get locked |
(code[]) |
codes()Produces an array of |
public readonly get locked |
(ulong) |
hash()Finds a hash value for the current object. |
public readonly get locked |
(int) |
size()Gets the number of |
public readonly get locked |
(long) |
sizeLong()Gets the number of |
public create() => ()
Creates a new empty String object of length zero.
public create(code[] data) => ()
Creates a new String object whose contents are the code values contained in the given array.
data - array specifying the contents of the array
IllegalArgumentException - if the code values do not specify legal UTF-8 code points
public create(String other) => ()
Creates a new String which is a copy of the given String.
other - String to copy
public create(ubyte[] data) => ()
Creates a new String object whose contents are the ubyte values contained in the given array.
data - array specifying the contents of the array
IllegalArgumentException - if the ubyte values do not specify legal UTF-8 code points
public destroy() => ()
public readonly locked compare(String other) => (int)
Compares the current object to another String, returning -1, 0, or 1, if the current object comes earlier, at exactly the same point, or later in a lexicographic ordering than the other value, respectively.
other - value to compare to
whether earlier, identical, or later
public readonly locked concatenate(nullable Object other) => (String)
Produces a new String object whose contents are made up of the code points contained in the current object followed by those in the String representation of the other object.
other - object convert to String and then concatenate with this object
concatenated String
public readonly locked concatenate(String other) => (String)
Produces a new String object whose contents are made up of the code points contained in the current object followed by those in the other object.
other - String object to concatenate with this object
concatenated String
public readonly copy(AddressMap addresses) => (String)
public readonly locked equal(String other) => (boolean)
Compares the current object to another String, returning true if they are identical.
other - object to compare to
true if identical
public readonly locked index(long location) => (ubyte)
Retrieves the ubyte value at the given offset inside the object.
index - offset inside the object
ubyte value
IndexOutOfBoundsException - if the offset is illegal
public readonly locked isEmpty() => (boolean)
Returns true if the String has length zero.
true if the length is zero
public readonly locked iterator() => (Iterator<code>)
Gets iterator that can iterate over each code point in the String.
iterator
public readonly locked substring(int start) => (String)
Produces a substring of this string representation, from the starting byte offset up to the end.
start - starting offset
substring
public readonly locked substring(int start, int end) => (String)
Produces a substring of this string representation, from the starting byte offset up to but not including the ending byte offset.
start - starting offset
end - ending offset
substring
public readonly locked toByte() => (byte)
Parses the String object as a byte.
byte value
NumberFormatException - if the String representation is not a legal byte
public readonly locked toDouble() => (double)
Parses the String object as a double.
double value
NumberFormatException - if the String representation is not a legal double
public readonly locked toFloat() => (float)
Parses the String object as a float.
float value
NumberFormatException - if the String representation is not a legal float
public readonly locked toInt() => (int)
Parses the String object as an int.
int value
NumberFormatException - if the String representation is not a legal int
public readonly locked toLong() => (long)
Parses the String object as a long.
long value
NumberFormatException - if the String representation is not a legal long
public readonly locked toLowerCase() => (String)
Returns a lower-case version of this String. Code points that are upper-case Latin letters are converted to lower-case versions in the returned String, and other code points are unaffected.
lower-case version
public readonly locked toShort() => (short)
Parses the String object as a short.
short value
NumberFormatException - if the String representation is not a legal short
public readonly locked toString() => (String)
Returns a String representation of this object, which is the object itself.
String representation
public readonly locked toUByte() => (ubyte)
Parses the String object as a ubyte.
ubyte value
NumberFormatException - if the String representation is not a legal ubyte
public readonly locked toUInt() => (uint)
Parses the String object as a uint.
uint value
NumberFormatException - if the String representation is not a legal uint
public readonly locked toULong() => (ulong)
Parses the String object as a ulong.
ulong value
NumberFormatException - if the String representation is not a legal ulong
public readonly locked toUShort() => (ushort)
Parses the String object as a ushort.
ushort value
NumberFormatException - if the String representation is not a legal ushort
public readonly locked toUpperCase() => (String)
Returns an upper-case version of this String. Code points that are lower-case Latin letters are converted to upper-case versions in the returned String, and other code points are unaffected.
upper-case version
public readonly get locked chars() => (immutable ubyte[])
Retrieves an immutable copy of the ubyte array inside the object.
byte array
public readonly get locked codes() => (code[])
Produces an array of code values corresponding to the UTF-8 code points stored in the object.
code array
public readonly get locked hash() => (ulong)
Finds a hash value for the current object.
hash value
public readonly get locked size() => (int)
Gets the number of ubyte values stored in the object as an int.
number of bytes
public readonly get locked sizeLong() => (long)
Gets the number of ubyte values stored in the object as a long.
number of bytes